<!DOCTYPE html>
<html lang="en">

<head>
    <meta charSet="utf-8" />
    <link rel="stylesheet" href="css/chunk.css" />
</head>

<body class="">
                        <article class="_2rhmJa">
                            <h1>一、JavaCrash的监控</h1><h4>    1.JavaCrash的异常大致流程</h4><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 428px;">
                                <div class="image-container-fill" style="padding-bottom: 61.08%;"></div>
                                <div class="image-view" data-width="2030" data-height="1240"><img src="upload/images/16293373-ec3a2ff1c4ebd6b5.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 310px;">
                                <div class="image-container-fill" style="padding-bottom: 44.22%;"></div>
                                <div class="image-view" data-width="2076" data-height="918"><img src="upload/images/16293373-c3b6b73afe21dbd0.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 656px;">
                                <div class="image-container-fill" style="padding-bottom: 34.67%;"></div>
                                <div class="image-view" data-width="1892" data-height="656"><img src="upload/images/16293373-47ee84eff3f93dea.png"></div>
                                </div>
                                <div class="image-caption">异常线程的区别</div>
                                </div><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 491px;">
                                <div class="image-container-fill" style="padding-bottom: 70.09%;"></div>
                                <div class="image-view" data-width="2454" data-height="1720"><img src="upload/images/16293373-1665f5792665cfeb.png"></div>
                                </div>
                                <div class="image-caption">设置uncaughtExceptionHandler异常处理器</div>
                                </div><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 686px;">
                                <div class="image-container-fill" style="padding-bottom: 97.87%;"></div>
                                <div class="image-view" data-width="1688" data-height="1652"><img src="upload/images/16293373-cedbf01a8eeee2c0.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 557px;">
                                <div class="image-container-fill" style="padding-bottom: 79.52%;"></div>
                                <div class="image-view" data-width="1816" data-height="1444"><img src="upload/images/16293373-4d7524f8486ccbf5.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 453px;">
                                <div class="image-container-fill" style="padding-bottom: 64.59%;"></div>
                                <div class="image-view" data-width="1446" data-height="934"><img src="upload/images/16293373-7929ed4d54aaa9cf.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><h4>    代码演示使用<br>
                                </h4><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 377px;">
                                <div class="image-container-fill" style="padding-bottom: 53.82%;"></div>
                                <div class="image-view" data-width="2070" data-height="1114"><img src="upload/images/16293373-f01817b6c6e59f01.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><p>        <b>原理文字描述：</b>JVM会调用Thread的dispatchUncaughtException的方法，把异常事件分发出去，线程里面有两个获取线程异常的方法：<b>setUncaughtExceptionHandler</b>（只处理当前线程的异常）和 <b>setDefaultUncaughtExceptionHandler</b>（处理所有线程的异常）两个方法，之所以线程崩溃是因为在Thread.UncaughtExceptionHandler重写它的uncaughtException的方法，调用了Process.killProcess方法和System.exit方法</p><h4>  2.出现crash异常应该怎么处理</h4><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 270px;">
                                <div class="image-container-fill" style="padding-bottom: 38.5%;"></div>
                                <div class="image-view" data-width="1844" data-height="710"><img src="upload/images/16293373-e5e5ce93606ef744.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><h4>  3.把混淆的代码需要还原</h4><p>       <b>客户端使用的方法-------&gt;GUI工具</b></p><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 694px;">
                                <div class="image-container-fill" style="padding-bottom: 37.269999999999996%;"></div>
                                <div class="image-view" data-width="1862" data-height="694"><img src="upload/images/16293373-d7f1a978bd0d31ff.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><p>        <b>服务端同学使用的方法 ------&gt;retrace命令</b>    </p><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 472px;">
                                <div class="image-container-fill" style="padding-bottom: 32.46%;"></div>
                                <div class="image-view" data-width="1454" data-height="472"><img src="upload/images/16293373-26ce872fbf02919c.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><p>二、NativeCrash监控处理方式</p><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 403px;">
                                <div class="image-container-fill" style="padding-bottom: 57.550000000000004%;"></div>
                                <div class="image-view" data-width="1880" data-height="1082"><img src="upload/images/16293373-f0938a0152a8b00c.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><p>现在采用的是：Google-breakpad做为主流</p><div class="image-package">
                                <div class="image-container" style="max-width: 700px; max-height: 302px;">
                                <div class="image-container-fill" style="padding-bottom: 27.66%;"></div>
                                <div class="image-view" data-width="1092" data-height="302"><img src="upload/images/16293373-c9c2ff3f2c46e7e7.png"></div>
                                </div>
                                <div class="image-caption"></div>
                                </div><p><b>采用add2Line工具把.so文件+偏移地址可以准确判定代码出错的位置</b></p>
                        </article>
</body>

</html>